package gmusic.bo;

import java.sql.ResultSet;
import java.sql.SQLException;

public class TrackBean {

	protected int id;

	private long maid = -1;
	
	protected String nom;

	protected int releaseId;
	
	private long releaseMaid;

	protected int disc;

	protected int numero;

	protected String lyrics = null;

	protected String commentaire = null;

	protected int duree;

	public TrackBean() {
	}

	public TrackBean(ResultSet r) throws SQLException {
		setId(r.getInt("ch_id"));
		setNom(r.getString("ch_nom"));
		setReleaseId(r.getInt("ch_al_id"));
		setNumero(r.getInt("ch_numero"));
		setLyrics(r.getString("ch_parole"));
		setDisc(r.getInt("disc"));
		setDuree(r.getInt("duree"));
	}

	public int getId() {
		return id;
	}

	public int getGmid() {
		return id;
	}
	
	public void setId(int i) {
		id = i;
	}

	public String getNom() {
		return nom;
	}

	public void setNom(String n) {
		nom = n;
	}

	public int getReleaseId() {
		return releaseId;
	}

	public void setReleaseId(int a) {
		releaseId = a;
	}

	public int getNumero() {
		return numero;
	}

	public String getNumeroString() {

		if (numero > 9)
			return "" + numero;
		else
			return "0" + numero;
	}

	public void setNumero(int n) {
		numero = n;
	}

	public boolean hasLyrics() {
		if (lyrics == null || (lyrics != null && lyrics.trim().equals(""))) {
			return false;
		} 
		return true;
	}
	
	public String getLyrics() {
		return lyrics;
	}

	public void setLyrics(String p) {
		lyrics = p;
	}

	public String getCommentaire() {
		return commentaire;
	}

	public void setCommentaire(String c) {
		commentaire = c;
	}

	public int getDisc() {
		return disc;
	}

	public void setDisc(int disc) {
		this.disc = disc;
	}

	public int getDuree() {
		return duree;
	}

	public void setDuree(int duree) {
		this.duree = duree;
	}

	public String toString() {
		return "[gmid=" + id + ";release_id=" + releaseId + ";disc=" + disc
				+ ";num=" + numero + ";titre=" + nom + ";duree=" + duree + "]";
	}

	public long getMaid() {
		return maid;
	}

	public void setMaid(long maid) {
		this.maid = maid;
	}

	public long getReleaseMaid() {
		return releaseMaid;
	}

	public void setReleaseMaid(long releaseMaid) {
		this.releaseMaid = releaseMaid;
	}
}